// @ts-ignore
import { request } from '@umijs/max';

// 获取历史记录
export async function getDocuments(params: any) {
  return request<API.ReqResult>(`/api/documents`, {
    method: 'get',
    params,
  });
}
// 删除文档
export async function delDocuments(id: any) {
  return request<API.ReqResult>(`/api/documents/${id}`, {
    method: 'DELETE',
  });
}
// 文档详情
export async function getDocumentsDetail(param: any) {
  const params = param.version_no ? { version_no: param.version_no } : {};
  return request<API.ReqResult>(`/api/documents/${param.id}`, {
    method: 'GET',
    params,
  });
}
// 更新/保存文档
export async function saveDocument(body: any) {
  return request<API.ReqResult>(`/api/documents/${body.uuid}`, {
    method: 'POST',
    data: body,
  });
}
